﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace blackhouse.BlackApart.Business.Prices {
    internal class PriceProfileLengthOfStayModification : PriceProfileModification {

        #region Fields

        private int lengthOfStayGreaterOrEqual;
        private int lengthOfStayLess;

        #endregion

        #region Constructors

        public PriceProfileLengthOfStayModification(int lengthOfStayGreaterOrEqual, int lengthOfStayLess, PriceProfileModificationType modType, double modValue)
            : base(modType, modValue) {
            this.lengthOfStayGreaterOrEqual = lengthOfStayGreaterOrEqual;
            this.lengthOfStayLess = lengthOfStayLess;
        }

        #endregion

        #region Methods

        public override bool IsApply(DateTime reservationFrom, DateTime reservationTo, int numberOfPeoples) {
            double td = ( reservationTo.Date - reservationFrom.Date ).TotalDays ;
            return td >= this.lengthOfStayGreaterOrEqual
                && td < this.lengthOfStayLess;
        }

        #endregion

    }
}
